<%@ page contentType="text/html;charset=UTF-8" import="java.sql.*" language="java" %>
<%
String JDBC_DRIVER = "com.mysql.jdbc.Driver";
String DB_URL = "jdbc:mysql://localhost:3306/sims";
String USER = "root";
String PASS = "123456";
String sql = "SELECT max(id) FROM student ";
        Class.forName(JDBC_DRIVER);
        Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
        PreparedStatement psmt = conn.prepareStatement(sql);

        ResultSet rs = psmt.executeQuery();
        rs.next();
        int id=rs.getInt(1)+1;
        conn.close();
%>
	<style>
 body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f2f2f2;
        }
        h1 {
            text-align: center;
            color: #333;
        }
        form {
            width: 300px;
            margin: 50px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            text-align: center;
        }
        input[type="text"] {
            width: 100%;
            padding: 10px;
            margin-bottom: 20px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }
        input[type="submit"] {
            padding: 10px 20px;
            background-color: #3498db;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #2980b9;
        }
         a {
            text-decoration: none;
            color: #1e90ff;}
    </style>
<html>
<head>
    <title>添加信息</title>
</head>
<body>
    <h1>学生信息添加</h1>
    <form action="insert.jsp">
    <tr>
       <td>学号：<input name="id" type="text" value="<%=id%>" /></td>
       <td>姓名：<input type="text" name="name" /></td>
        <td>性别：<input type="text" name="gender" /></td>
        <td>手机号码：<input type="text" name="phone" /></td>
        <td><input type="submit" value="添加信息" /></td><br>
        <a href="index.jsp">返回学生信息页</a>
      </tr>
    </form>

</body>
</html>
